package thesis.filesharing.common.exception.functional;


public class ObjectNotFoundException extends AppFunctionalException {
	
	private static final long serialVersionUID = -6852952533594931486L;
	
	private Class<?> notFoundObject;
	
	public Class<?> getNotFoundObject() {
		return notFoundObject;
	}

	public void setNotFoundObject(Class<?> notFoundObject) {
		this.notFoundObject = notFoundObject;
	}

	public ObjectNotFoundException() {
		super();
	}
	
	public ObjectNotFoundException(Throwable throwable, Class<?> notFoundObject) {
		super(throwable);
		this.notFoundObject = notFoundObject;
	}
	
	public ObjectNotFoundException(String msg, Throwable throwable, Class<?> notFoundObject) {
		super(msg, throwable);
		this.notFoundObject = notFoundObject;
	}

	@Override
	public String getMessage() {
		String errorMessage = String.format("Object has type %s could not be found", notFoundObject.getClass().getCanonicalName());
		return new StringBuffer(errorMessage).append(super.getMessage()).toString();
	}
}
